<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

<div id="result"></div>

<script>
    (function(){
        var worker = new Worker('./worker.js');
        worker.postMessage({name:1});
        worker.onmessage = function (event) {
            console.log(event);
            console.log('子线程返回：', event.data);
            worker.terminate();
        };
    })();

</script>

</body>
</html>